import 'package:freemusic/model/AbstractModel.dart';

class Gedan extends AbstractModel {
  String gdName;
  String picture;
  String description;
  int count = 0;          // 歌曲数
  DateTime created;

  Gedan({this.gdName, this.picture, this.description, this.count, this.created});

  void fromDataBase(Map map) {
    this.id = int.parse(map['id'].toString());
    this.gdName = map['gd_name'];
    this.picture = map['picture'];
    this.description = map['description'];
    this.count = map['count'];
    this.created = DateTime.parse(map['created'].toString());
    _dealFieldsIsNull();
  }

  void _dealFieldsIsNull(){
    String description = this.description;
    if(description == null){
      this.description = "";
    }
    if(count == null){
      this.count = 0;
    }
    // if(picture == null){
    //   picture = "https://picsum.photos/50/50";
    // }
  }
}
